/*
 * Powered By cuichen
 * Since 2014 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.delivery.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.delivery.domain.Delivery;
import com.seeyoui.kensite.bussiness.orderlang.delivery.domain.DeliveryExamineProductVO;
import com.seeyoui.kensite.bussiness.orderlang.delivery.domain.DeliveryExamineTitleVO;
import com.seeyoui.kensite.bussiness.orderlang.delivery.domain.DeliveryVO;
import com.seeyoui.kensite.bussiness.orderlang.delivery.persistence.DeliveryMapper;

/**
 * Delivery
 * @author cuichen
 * @version 2.0
 * @since 1.0
 * @date 2018-03-01
 */

@Service
public class DeliveryService extends BaseService {
	
	@Autowired
	private DeliveryMapper deliveryMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public Delivery findOne(String id) throws CRUDException{
		return deliveryMapper.findOne(id);
	}
	
	/**
     * 加载审批列表头部信息
     * @param id
     * @return
     * @throws CRUDException
     */
    public DeliveryExamineTitleVO findDeliveryDetailForTitle(String id) throws CRUDException{
        return deliveryMapper.findDeliveryDetailForTitle(id);
    }
    
    /**
     * 加载审批列表商品信息
     * @param id
     * @return
     * @throws CRUDException
     */
    public List<DeliveryExamineProductVO> findDeliveryDetailForProduct(String id) throws CRUDException{
        return deliveryMapper.findDeliveryDetailForProduct(id);
    }
	
	/**
	 * 查询数据集合
	 * @param delivery
	 * @return
	 * @throws CRUDException
	 */
	public List<Delivery> findList(Delivery delivery) throws CRUDException {
		return deliveryMapper.findList(delivery);
	}
	
	/**
     * 查询数据集合 
     * @param delivery
     * @return
     * @throws CRUDException
     */
    public List<DeliveryVO> findListRelationOrder(Map map) throws CRUDException {
        return deliveryMapper.findListRelationOrder(map);
    }
	
	/**
	 * 查询所有数据集合
	 * @param delivery
	 * @return
	 * @throws CRUDException
	 */
	public List<Delivery> findAll(Delivery delivery) throws CRUDException {
		return deliveryMapper.findAll(delivery);
	}
	
	/**
	 * 查询数据总数
	 * @param delivery
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(Delivery delivery) throws CRUDException {
		return deliveryMapper.findTotal(delivery);
	}
	
	/**
     * 查询数据总数
     * @param delivery
     * @return
     * @throws CRUDException
     */
    public int findTotalRelationOrder(Map map) throws CRUDException {
        return deliveryMapper.findTotalRelationOrder(map);
    }
	
	/**
	 * 查询数据总数排除当前数据
	 * @param delivery
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(Delivery delivery) throws CRUDException {
		return deliveryMapper.findExTotal(delivery);
	}
	
	/**
	 * 数据新增
	 * @param delivery
	 * @throws CRUDException
	 */
	public void save(Delivery delivery) throws CRUDException{
		delivery.preInsert();
		deliveryMapper.save(delivery);
	}
	
	/**
	 * 数据修改
	 * @param delivery
	 * @throws CRUDException
	 */
	public void update(Delivery delivery) throws CRUDException{
		delivery.preUpdate();
		deliveryMapper.update(delivery);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		deliveryMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param delivery
	 * @throws CRUDException
	 */
	public void remove(Delivery delivery) throws CRUDException{
		delivery.preUpdate();
		deliveryMapper.remove(delivery);			
	}
	
}